<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		onLoad:function(){
			let token = uni.getStorageSync('token')
			let username = uni.getStorageSync('username')
			this.$http('/gjcApi/verifyToken', {username, token}, res => {
				if(res.code == 406){
					uni.removeStorageSync('token')
					uni.showModal({
						title: '登录验证',
						cancelText: '暂时不用',
						cancelColor: '#999999',
						confirmText: '前往登录',
						confirmColor: '#f18b49',
						content: '登录账号享受更多优惠，是否登录账号？',
						success: (res) => {
							if (res.confirm) {
								uni.navigateTo({
									url: '/pages/login/login'
								})
							}
						}
					})
				}
			})
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "/uni_modules/uview-ui/index.scss";
	page {
		background-color: $uni-bg-color;
	}
</style>
